package com.aiju.widgit.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.aiju.base.R;
import com.aiju.base.dialog.BaseDialog;
import com.aiju.common.PixValue;

/**
 * @author: 佐为
 * @date: 2016-12-14 16:22
 * @version: V1.0
 * @Description: 描述
 */
public class OrderDialog extends BaseDialog {

    private TextView text;

    private View inflate;

    private View.OnClickListener onClickListener;

    public OrderDialog(Context context) {
        super(context);
    }

    @Override
    protected int getDialogStyleId() {
        return R.style.LodingDialogStyle;
    }

    @Override
    protected View getView() {
        inflate = mLayoutInflater.inflate(R.layout.dialog_order, null);
        TextView textView = (TextView) inflate.findViewById(R.id.tv_order_pay);
        textView.setText("取消");
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        text = (TextView) inflate.findViewById(R.id.tv_shop_money);
        return inflate;
    }

    public OrderDialog setTotalPrice(String price) {
        text.setText(price);
        return this;
    }

    public OrderDialog setListener(View.OnClickListener onClickListener) {
        this.onClickListener = onClickListener;
        inflate.findViewById(R.id.tv_pay_qr).setOnClickListener(onClickListener);
        inflate.findViewById(R.id.tv_pay_wechat).setOnClickListener(onClickListener);
        inflate.findViewById(R.id.tv_pay_money).setOnClickListener(onClickListener);
        inflate.findViewById(R.id.tv_pay_zhif).setOnClickListener(onClickListener);
        return this;
    }

    /**
     * 设置对话框LayoutParams
     *
     * @return
     */
    public OrderDialog setLayoutParams() {
        getDialogWindow().setWindowAnimations(R.style.share_animation);
        getDialogWindow().setGravity(Gravity.BOTTOM);
        getDialogWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, PixValue.dp.valueOf(284));//设置横向全屏
        return this;
    }
}
